{include file="common/header-top" /}


<style>
    .user-name{
        font-size: 15px;
        font-weight: 600;
    }
    .van-circle__text{
        font-size: 18px !important;
    }
</style>


<div id='app' v-cloak>

    <van-nav-bar title="钱包中心" left-arrow @click-left="goBack" left-text="返回" > </van-nav-bar>

    <van-row>
        <van-grid :column-num="2">
            <van-grid-item
                    icon="/__FRONT__/images/icon/publish-bean.png"
                    text="发布豆"
                    :info="showPublishBean"
                    url="/index/Userwallet/beanRecord?type=1"
            ></van-grid-item>
            <van-grid-item
                    icon="/__FRONT__/images/icon/wallet-jifen.png"
                    text="积分"
                    :info="showCredits"
                    url="/index/Userwallet/creditsRecord"
            ></van-grid-item>
        </van-grid>
    </van-row>


    <!--购买发布豆-->
    <!--
    <van-notice-bar :scrollable="false" wrapable >
        <van-row style="margin-top: 5px;">
            <van-col span="4">
                <van-icon
                    name="/__FRONT__/images/icon/wallet-buy.png"
                    size="50px"
                    @click="goBuyBean"
                >
                </van-icon>
            </van-col>
            <van-col span="14">
                <span class="van-multi-ellipsis--l2" style="font-size: small;padding-top: 2%;">
                    发布豆兑换: 一元 = {{publishBeanRate}} 发布豆<br/>
                    发布兼职需要消耗发布豆哦～
                </span>
            </van-col>
            <van-col span="6">
                <van-button type="danger" @click="goBuyBean" >购买豆</van-button>
            </van-col>
        </van-row>
    </van-notice-bar>
    -->
    <!--购买发布豆-->


    <van-divider></van-divider>

    <!--我的发布豆-->
    <van-row>
        <van-col span="24">
            <van-cell title="发布豆" icon="/__FRONT__/images/icon/publish-bean.png">
            </van-cell>
            <van-grid :column-num="2" icon-size="45px">
                <van-grid-item
                        icon="/__FRONT__/images/icon/bean-add.png"
                        text="购买记录"
                        url="/index/Userwallet/beanRecord?type=1"
                ></van-grid-item>
                <van-grid-item
                        icon="/__FRONT__/images/icon/bean-reduce.png"
                        text="消耗记录"
                        url="/index/Userwallet/beanRecord?type=2"
                ></van-grid-item>
            </van-grid>
        </van-col>
    </van-row>
    <!--我的发布豆-->


    <!--我的积分-->
    <van-row>
        <van-col span="24">
            <van-cell title="积分" icon="/__FRONT__/images/icon/wallet-jifen.png">
            </van-cell>
            <van-grid :column-num="2" icon-size="45px">
                <van-grid-item
                        icon="/__FRONT__/images/icon/jifen-add.png"
                        text="获得记录"
                        url="/index/Userwallet/creditsRecord?type=1"
                >
                </van-grid-item>
                <van-grid-item
                        icon="/__FRONT__/images/icon/jifen-reduce.png"
                        text="消耗记录"
                        url="/index/Userwallet/creditsRecord?type=2"
                >
                </van-grid-item>
            </van-grid>
        </van-col>
    </van-row>
    <!--我的积分-->



    {include file="common/foot-bar" /}

</div>









<script>

    Vue.use(vant.Lazyload);

    var vm = new Vue({
        el: '#app',
        data() {
            return {
                currentRate: 0,
                active:3,
                userCenterIcon: {
                    normal: '/__FRONT__/images/icon/usercenter-n.png',
                    active: '/__FRONT__/images/icon/usercenter-a.png'
                },
                erShouIcon: {
                    normal: '/__FRONT__/images/icon/ershou-n.png',
                    active: '/__FRONT__/images/icon/ershou-a.png'
                },


                userInfo:{},
                userExtend:{},


                walletInfo:{},
                publishBeanRate:'',

            };
        },

        created(){

            axiosRequest.get('/api/user/myWallet').then(function (response) {
                if (response.code == 200) {
                    vm.$data.walletInfo = response.data.walletInfo;
                    vm.$data.publishBeanRate = response.data.publishBeanRate;
                } else {
                    vant.Toast(response.msg);
                }
            });



            axiosRequest.get('/api/user/userInfo',{params:{userExtend:1}}).then(function (response) {
                if (response.code == 200) {
                    vm.$data.userInfo = response.data.userInfo;
                    vm.$data.userExtend = response.data.userInfo.extend;
                } else {
                    vant.Toast(response.msg);
                }
            });

        },

        computed:{
            creditPointsText(){
                return this.userExtend.credit_score + '分';
            },
            //展示发布豆
            showPublishBean(){
                return (this.walletInfo.publish_bean > 10000) ? '9999+' : this.walletInfo.publish_bean;
            },
            //展示积分
            showCredits(){
                return (this.walletInfo.credits > 10000) ? '9999+' : this.walletInfo.credits;
            }
        },

        methods:{
            //返回上一页
            goBack(){
                history.back();
            },

            //购买发布豆界面
            goBuyBean(){
                window.location.href = "/index/Userwallet/buyBean";
            }

        }
    });




</script>







{include file="common/foot-bottom" /}
